<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/jsp/common/common.jsp" %>
<%
	String documentType = request.getAttribute("documentType") == null?"":request.getAttribute("documentType").toString();
	String processInstanceId = request.getAttribute("processInstanceId") == null?"":request.getAttribute("processInstanceId").toString();
	String taskId = request.getAttribute("taskId") == null?"":request.getAttribute("taskId").toString();
	String processDefinitionId = request.getAttribute("processDefinitionId") == null?"":request.getAttribute("processDefinitionId").toString();
	String version = request.getAttribute("version") == null?"":request.getAttribute("version").toString();
	String domainId = request.getAttribute("domainId") == null?"":request.getAttribute("domainId").toString();
	

%>
</head>
<body>

<div class="documentContent"  id="documentContent">
	
	<div>
	  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="search-table">
	    <tr>
	      <td>
	       <button class="btn-table" id="submitButton">提交</button>
	       <button class="btn-table" id="saveButton">保存</button>
	      </td>
	    </tr>
	  </table>
	</div>
	
	<!-- form-box -->
	<div class="form-box">
		<h2 class="form-title">申请人基本信息<em class="show"></em></h2>
		<div class="form-content">
		 	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table">
		 		<tr>
		 			<td class="form-table-tdleft" width="12%">申请单号</td>
		 			<td width="13%"><span id="systemName_span"></span></td>
		 			<td class="form-table-tdleft" width="12%">申请人</td>
		 			<td width="13%"><span id="systemArch_span"></span></td>
		 			<td class="form-table-tdleft" width="12%">申请部门</td>
		 			<td width="13%"><span id="systemVersion_span"></span></td>
		 			<td class="form-table-tdleft" width="12%">申请时间</td>
		 			<td width="13%"><span id="AvailableProcessors_span"></span></td>
		 		</tr>
		 	</table>
		</div>
	</div>
	<!-- form-box -->
	
	<!-- form-box -->
	<div class="form-box">
		<h2 class="form-title">短信申请内容<em class="show"></em></h2>
		<div class="form-content">
		 	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table">
		 		<tr>
		 			<td class="form-table-tdleft" width="12%">短信名称</td>
		 			<td width="13%"><span id="systemName_span"></span></td>
		 			<td class="form-table-tdleft" width="12%">短信性质</td>
		 			<td width="13%"><span id="systemArch_span"></span></td>
		 			<td class="form-table-tdleft" width="12%">短信发送对象</td>
		 			<td width="13%"><span id="systemVersion_span"></span></td>
		 			<td class="form-table-tdleft" width="12%">是否包含移动卡客户</td>
		 			<td width="13%"><span id="AvailableProcessors_span"></span></td>
		 		</tr>
		 	</table>
		</div>
	</div>
	<!-- form-box -->
	
	<!-- form-box -->
	<div class="form-box">
		<h2 class="form-title">团队经理<em class="show"></em></h2>
		<div class="form-content">
		 	<table width="100%" border="0" cellpadding="0" cellspacing="0" class="form-table">
		 		<tr>
		 			<td class="form-table-tdleft" width="12%">主管</td>
		 			<td width="87%">
		 				<input type="text" class="table-input" name="teamLeader" id="teamLeader" value="" />
		 				<input type="hidden" name="teamLeaderId" id="teamLeaderId" value="" />
		 			</td>
		 		</tr>
		 	</table>
		</div>
	</div>
	<!-- form-box -->
	

<div>
<p>documentType :<input type="text" name="documentType" id="documentType" value="<%=documentType%>" /></p>
<p>processInstanceId :<input type="text" name="processInstanceId" id="processInstanceId" value="<%=processInstanceId%>" /></p>
<p>taskId :<input type="text" name="taskId" id="taskId" value="<%=taskId%>" /></p>
<p>processDefinitionId :<input type="text" name="processDefinitionId" id="processDefinitionId" value="<%=processDefinitionId%>" /></p>
<p>version :<input type="text" name="version" id="version" value="<%=version%>" /></p>
<p>domainId :<input type="text" name="domainId" id="domainId" value="<%=domainId%>" /></p>

<p></p>
</div>


</div>

<script type="text/javascript">
$(document).ready(function(){

	blindPageElement();
	
	getPageData();
	
});

function blindPageElement(){
	
	$(".form-title").click(function(){
        var b = $(this).parent(".form-box").children(".form-content");
        if(b.css("display") == "block"){
			b.slideUp();
            $(this).children("em").removeClass("show");
            $(this).children("em").addClass("hide");
        }else{
            $(this).children("em").removeClass("hide");
            $(this).children("em").addClass("show");
			b.slideDown();
        }
    });
	
	$('#saveButton').on('click',function(){
		var url = '<%=basePath%>/smp/approve/saveOperation.do?processInstanceId='+$('#processInstanceId').val();
	 	url = url + '&taskId='+$('#taskId').val();
	 	url = url + '&processDefinitionId='+$('#processDefinitionId').val();
	 	url = url + '&version='+$('#version').val();
	 	url = url + '&teamLeaderId='+$('#teamLeaderId').val();
	 	
	 	$.ajax({  
	        url:url,  
	        type:'post',  
	        dataType:'json',  
	        success:function(data,textStatus,jqXHR){  
	        	alert('保存成功');
	        },  
	        error:function(XMLHttpRequest,textStatus,errorThrown){  
	        	alert('保存失败');
	        }                     
	    });
	});
	
	
	$('#submitButton').on('click',function(){
	 	var url = '<%=basePath%>/smp/approve/submitOperation.do?processInstanceId='+$('#processInstanceId').val();
	 	url = url + '&taskId='+$('#taskId').val();
	 	url = url + '&processDefinitionId='+$('#processDefinitionId').val();
	 	url = url + '&version='+$('#version').val();
	 	url = url + '&teamLeaderId='+$('#teamLeaderId').val();
		$.ajax({  
	        url:url,  
	        type:'post',  
	        dataType:'json',  
	        success:function(data,textStatus,jqXHR){  
	        	alert('提交成功');
	        },  
	        error:function(XMLHttpRequest,textStatus,errorThrown){  
	        	alert('提交失败');
	        }                     
	    });
	});
	
	$("#teamLeader").autocomplete({
		url : '<%=basePath%>/biz/ou/employee/getEmployeeIdentityForComplete.do?domainId=<%=domainId%>',
		contentFormatter : function( text, data ){
			return data.empName + ' '+data.empSerialNumber+' ' + data.orgName + ' ' + data.positionName;
		},
		textFormatter : function(data){
 			return data.empName + ' '+ data.empSerialNumber+' ' + data.orgName + ' ' + data.positionName;
		}, 
		postSelect : function(data){
			$('#teamLeaderId').val(data.eiId);
		}
	});	


}

function getPageData(){
	
}

</script>
</body>
</html>